<?php 

class cUrl {
	var $handle;
	
	function __construct() {
		$this->handle = curl_init();
		$this->setopt(CURLOPT_RETURNTRANSFER, TRUE);
		$this->setopt(CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
		$this->setopt(CURLOPT_TIMEOUT, 30);
		$this->setopt(CURLOPT_COOKIEFILE, "ShouldNeverExist");
		$this->setopt(CURLOPT_FOLLOWLOCATION, TRUE);
		$this->setopt(CURLOPT_MAXREDIRS, 3);
	}
	
	function __destruct() {
		curl_close($this->handle); 
	}
	
	function setopt($option, $value) {
		curl_setopt($this->handle, $option, $value);
	}
	
	function get($url) {
		$this->setopt(CURLOPT_HTTPGET, TRUE);
		$this->setopt(CURLOPT_URL, $url);
		return curl_exec($this->handle);
	}

	function post($url, $fields) {
		$this->setopt(CURLOPT_POST, TRUE);
		$this->setopt(CURLOPT_POSTFIELDS, $fields);
		$this->setopt(CURLOPT_URL, $url);
		return curl_exec($this->handle);
	}

	function getinfo($option="") {
		return curl_getinfo($this->handle, $option);
	}
}

?>